package curriculos.servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import curriculos.negocio.BancoDeCurriculos;
import curriculos.negocio.Curriculo;

@WebServlet("/")
public class Principal extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private BancoDeCurriculos negocio;
       
    public Principal() {
        super();
    }

	public void init(ServletConfig config) throws ServletException {
		negocio = new BancoDeCurriculos();
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Curriculo> curriculos = negocio.getCurriculos();
		request.setAttribute("curriculos", curriculos);
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

}
